package com.example.chapter03;

import androidx.appcompat.app.AppCompatActivity;

import android.graphics.Color;
import android.os.Bundle;
import android.widget.TextView;

public class TextColorActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_text_color);

        TextView textView = findViewById(R.id.tv_code_system);
        //textView设置为系统自带的绿色
        textView.setTextColor(Color.GREEN);

        TextView textView1 = findViewById(R.id.tv_code_eight);
        //textView1文字颜色设置为不透明的绿色、即正常的绿色
        textView1.setTextColor(0Xff00ff00);

        //与上面相对比、去掉ff的话就是透明的颜色、透明的会看不到
        TextView textView2 = findViewById(R.id.tv_code_six);
        textView2.setTextColor(0X00ff00);

        //与上面相对比、去掉ff的话就是透明的颜色、透明的会看不到
        TextView textView3 = findViewById(R.id.tv_code_1);
        textView3.setTextColor(0Xff00ff00);

        //获取布局、设置背景颜色
        TextView textView4 = findViewById(R.id.tv_code_background);
        //系统自带的颜色
//        textView4.setBackgroundColor(Color.GREEN);
        //颜色来源于资源文件
        textView4.setBackgroundResource(R.color.green);

    }
}